#include "Route.h"

CRoute::CRoute(void):numberOfWayPoint(0), wayPoint(new CSimpleLinkedList<CVector2D>())
{}

CRoute::~CRoute(void)
{
	delete wayPoint;
	wayPoint=0;
	this->numberOfWayPoint=0;
}

/*add a waypoint to the route*/
void CRoute::addWaypoint(CVector2D v)
{
	this->wayPoint->addToList(v);
	this->numberOfWayPoint++;
}
void CRoute::setNumberOfWayPoint(int numberOfWayPoint)
{
	this->numberOfWayPoint=numberOfWayPoint;
}
int CRoute::getNumberOfWayPoint(void)const
{
	return this->numberOfWayPoint;
}

CVector2D CRoute::getWayPoint(int indexWayPoint)
{
	if(indexWayPoint<this->numberOfWayPoint)
	{
		return this->wayPoint->getElement(indexWayPoint);
	}
	return CVector2D(-1,-1);
}